package com.learn.project.plan;

import com.learn.project.plan.bean.Plan;
import com.learn.project.plan.bean.Task;
import com.learn.project.plan.service.LearnPlanService;
import com.learn.project.plan.service.impl.LearnPlanServiceImpl;
import com.uptool.io.util.FileUtil;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

/**
 * @Description: 学习计划程序入口
 * @Author: chenfuyuan
 * @Date: 2021/4/27 20:04
 */
public class LearnPlanApplication {

    private static LearnPlanService learnPlanService;

    static {
        learnPlanService = new LearnPlanServiceImpl();
    }

    public static void main(String[] args) throws IOException, ClassNotFoundException {
        //读取文件
        Plan plan = learnPlanService.getPlan();
        Task currentTask = plan.getCurrentTask();
        System.out.printf("当前应该完成的任务为:{%s},时间为{%s}\n", currentTask.getDetail(), currentTask.getTime());
        Scanner scanner = new Scanner(System.in);
        System.out.println("是否完成?(Y/N):");
        String next = scanner.next().toLowerCase();
        if (next.contains("y")) {
            plan.finishTask();
        }

        //保存计划
        learnPlanService.savePlan(plan);
    }
}
